<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var arr = function (s) {
      let i = 0, j = s.length - 1;
      let aaa = function (s, i, j) {
        for (; i <= j; i++, j--) {
          if (s[i] !== s[j]) return false;
        }
        return true;
      };
      for (; i <= j; i++, j--) {
        if (s[i] !== s[j]) return aaa(s, i + 1, j) || aaa(s, i, j - 1);
      }
      return true;
    };
    console.log(arr('abca'));
  </script>
</body>

</html>